<?php
namespace app\serveruser\validate;
use \app\manage\validate\BaseValidate;
/**
 * Token管理的验证类
 * @author adv30 <adv30@126.com> 2017年6月5日14:31:16
 */
class Token extends BaseValidate
{
    // 是否使用true基础的验证规则
    // protected $useBaseRules = false;
    protected $rule = [
        'id' => ['integer', 'gt' => '0'],
        'create_ip' => ['ip'],
        'create_app_key' => ['length' => '32'],
        'token' => ['length' => '32'],
        'arr' => ['array'],
        'key' => ['length' => '1,128'],
        'auth' => ['length' => '1,128'],
        'roles' => ['length' => '2,128'],
        'auths' => ['array', 'min' => '1']
    ];
    protected $message = [];
    protected $scene = [
        'create' => ['id', 'create_ip', 'create_app_key'],
        'delete' => ['token'],
        'hGetAll' => ['token'],
        'hMset' => ['token','arr'],
        'empty' => ['token'],
        'hExists' => ['token', 'key'],
        'check' => ['token', 'auth'],
        'addRoles' => ['token', 'roles'],
        'checkAuths' => ['token', 'auths'],
        'getRoles' => ['token'],
        'getAuthByToken' => ['token']
    ];
}
